<link rel="stylesheet" type="text/css" href="<?= $base_url ?>css/fmis/document/view.css">

<div class="document">
    <div class="search">
        <div class="tab-pane" id="search">
            <div class="container-fluid">
                <div class="col-lg-3">
                    <h3>Search a File</h3>
                    <?php echo form_open('fmis/document/search', array('class' => 'form-search')); ?>
                    <div class="search-filter-group">
                        <p>
                            <input type="checkbox" name="cb_document_name_filter" value="document_name_filter" <?php if($cb_document_name) echo 'checked';?>>  Search by Document Name<br/>
                            <input type="text" id="document_name_filter" name="document_name_filter" value="<?php echo $document_name?>"/>
                        </p>
                        <p>
                            <input type="checkbox" name="cb_uploader_name_filter" value="uploader_name_filter" <?php if($cb_uploader_name) echo 'checked';?>>  Search by Uploader Name<br/>
                            <input type="text" id="uploader_name_filter" name="uploader_name_filter" value="<?php echo $uploader_name?>"/>
                        </p>
                        <p>
                            <input type="checkbox"  id="cb_dept_filter" name="cb_dept_filter" value="dept_filter" <?php if($cb_dept) echo 'checked';?>>  Search by Department Uploader<br/>
                            <!--<input type="text" id="dept_filter" name="dept_filter" value="<?php echo $dept?>"/>-->
                            <select id="dept_filter" name="dept_filter">
                                <?php
                                foreach($departments as $department) {
                                    $selected = "";
                                    if($dept == $department["DepartmentDescription"])
                                        $selected = "selected";
                                    ?>
                                    <option value="<?= $department["DepartmentID"]?>" <?= $selected ?>><?= $department["DepartmentDescription"]?></option>;
                                <?php } ?>
                            </select>
                        </p>
                        <button class="btn btn-primary" type="submit" id="btnSearch">Search</button>
                    </div>
                    <?php echo form_close();?>
                </div>
                <div class="col-lg-9">
                    <h3>Search Results</h3>
                    <div class="document-results">
                        <?php foreach($uploads_owner as $doc) {
                            $id = $doc['DocumentID'];
                            $documentNam = $doc['DocumentName'];
                            $uploaderNam = $doc['UploaderName'];
                            $date = $doc['DateUploaded'];
                            $publicityName = $doc['PublicityName'];
                            $publicityID = $doc['PublicityID'];
                            $origName = $doc['OriginalName'];
                            $desc = $doc['Description'];
                            ?>
                            <div id="document<?= $id?>" class="document-result" documentID="<?= $id?>">
                                <div class="content-holder container-fluid" >
                                    <div class="details col-lg-6">
                                        <p class="documentname">
                                            Document Name: <?= $documentNam?>
                                            <input type="hidden" value=" <?= $documentNam?>">
                                        </p>
                                        <p class="uploadername">
                                            Uploader Name: <?= $uploaderNam?>
                                            <input type="hidden" value=" <?= $uploaderNam?>">
                                        </p>
                                        <p class="dateuploaded">
                                            Date Uploaded: <?= $date?>
                                            <input type="hidden" value=" <?= $date?>">
                                        </p>
                                        <p class="status" publicityid="<?= $publicityID?>">
                                            Publicity: <?= $publicityName?>
                                        </p>
                                        <p class="originalname">
                                            Original Document Name: <?= $origName?>
                                            <input type="hidden" value=" <?= $origName?>">
                                        </p>
                                    </div>
                                    <div class="description col-lg-6">
                                        <label for="input-description">Description: </label>
                                        <textarea id="input-description" name="input-description" value="<?= $desc?>" readonly><?= $desc?></textarea>
                                    </div>
                                    <div class="clear-both"></div>
                                    <div class="control-holder">
                                        <button class="button button-primary" id="btnDownload">Download Document</button>
                                        <button class="button" id="btnEdit">Edit Details</button>
                                        <button class="button" id="btnDelete">Delete</button>
                                    </div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>